package com.peanut.sql.lineage.postgresql;

import java.util.List;
import java.util.Objects;

/****
 author:yifan
 date:2016
 description:
 **/
public class Schema extends Vertex {
    private String schemaName;
    private Database database;
    private List<Table> tables;

    public Schema(String schemaName, Database database, List<Table> tables) {
        this.schemaName = schemaName;
        this.database = database;
        this.tables = tables;
    }

    public Schema() {
    }

    public String getSchemaName() {
        return schemaName;
    }

    public void setSchemaName(String schemaName) {
        this.schemaName = schemaName;
    }

    public Database getDatabase() {
        return database;
    }

    public void setDatabase(Database database) {
        this.database = database;
    }

    public List<Table> getTables() {
        return tables;
    }

    public void setTables(List<Table> tables) {
        this.tables = tables;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Schema schema = (Schema) o;
        return Objects.equals(schemaName, schema.schemaName) &&
                Objects.equals(database, schema.database) &&
                Objects.equals(tables, schema.tables);
    }

    @Override
    public int hashCode() {
        return Objects.hash(schemaName, database, tables);
    }

    @Override
    public String toString() {
        return database + "." + schemaName;
    }
}
